import {RouteRecordRaw} from 'vue-router';
import {Layout} from '@/router/constant';
import {ManageAccountsOutlined} from '@vicons/material';
import {SettingOutlined} from '@vicons/antd';
import {renderIcon} from '@/utils/index';

const routeName = 'configure';

/**
 * @param name 路由名称, 必须设置,且不能重名
 * @param meta 路由元信息（路由附带扩展信息）
 * @param redirect 重定向地址, 访问这个路由时,自定进行重定向
 * @param meta.disabled 禁用整个菜单
 * @param meta.title 菜单名称
 * @param meta.icon 菜单图标
 * @param meta.keepAlive 缓存该路由
 * @param meta.sort 排序越小越排前
 * */
const routes: Array<RouteRecordRaw> = [
    {
        path: '/configure',
        name: routeName,
        redirect: '/configure/account',
        component: Layout,
        meta: {
            title: '配置',
            icon: renderIcon(SettingOutlined),
            permissions: ['dashboard_dataOverview', 'dashboard_dailyBill', 'dashboard_rankManage'],
            sort: 7,
        },
        children: [
            {
                path: 'account',
                name: `${routeName}_account`,
                redirect: '/configure/account/operationRecord',
                meta: {
                    title: '账号',
                    permissions: [],
                    keepAlive: false,
                    icon: renderIcon(ManageAccountsOutlined)
                },
                children: [{
                    path: 'operationRecord',
                    name: `configure_account_operationRecord`,
                    meta: {
                        title: '操作记录',
                        permissions: ['configure_account_operationRecord'],
                        keepAlive: false,
                    },
                    component: () => import('@/views/configure/account/operationRecord/operationRecord.vue')
                },{
                    path: 'setting',
                    name: `configure_account_setting`,
                    meta: {
                        title: '个人设置',
                        keepAlive: false,
                        activeMenu:'configure_account_setting'
                    },
                    component: () => import('@/views/configure/account/account.vue')
                }]
            },

            {
                path: 'thirdPartyConfig',
                name: `${routeName}_thirdPartyConfig`,
                redirect: '/configure/thirdPartyConfig/wechatMobileApplication',
                meta: {
                    title: '第三方配置管理',
                    permissions: [],
                    keepAlive: false,
                    icon: renderIcon(ManageAccountsOutlined)
                },
                children: [
                    {
                        path: 'wechatMobileApplication',
                        name: `${routeName}_thirdPartyConfig_wechatMobileApplication`,
                        meta: {
                            title: '微信移动应用',
                            permissions: ['configure_thirdPartyConfig_wechatMobileApplication'],
                            keepAlive: false,
                        },
                        component: () => import('@/views/configure/thirdPartyConfig/wechatMobileApplication/wechatMobileApplication.vue')
                    },
                    {
                        path: 'wechatOfficialAccount',
                        name: `${routeName}_thirdPartyConfig_wechatOfficialAccount`,
                        meta: {
                            title: '微信公众号',
                            permissions: ['configure_thirdPartyConfig_wechatOfficialAccount'],
                            keepAlive: false,
                        },
                        component: () => import('@/views/configure/thirdPartyConfig/wechatOfficialAccount/wechatOfficialAccount.vue')
                    },
                    {
                        path: 'wechatMerchantPlatform',
                        name: `${routeName}_thirdPartyConfig_wechatMerchantPlatform`,
                        meta: {
                            title: '微信商户平台',
                            permissions: ['configure_thirdPartyConfig_wechatMerchantPlatform'],
                            keepAlive: false,
                        },
                        component: () => import('@/views/configure/thirdPartyConfig/wechatMerchantPlatform/wechatMerchantPlatform.vue')
                    },
                    {
                        path: 'alipay',
                        name: `${routeName}_thirdPartyConfig_alipay`,
                        meta: {
                            title: '支付宝',
                            permissions: ['configure_thirdPartyConfig_alipay'],
                            keepAlive: false,
                        },
                        component: () => import('@/views/configure/thirdPartyConfig/alipay/alipay.vue')
                    },
                    {
                        path: 'smsConfig',
                        name: `${routeName}_thirdPartyConfig_smsConfig`,
                        meta: {
                            title: '短信配置',
                            permissions: ['configure_thirdPartyConfig_smsConfig'],
                            keepAlive: false,
                        },
                        component: () => import('@/views/configure/thirdPartyConfig/smsConfig/smsConfig.vue')
                    }

                ]
            },
        ],
    },
];

export default routes;
